package com.webapp.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.webapp.service.LoginService;

import lombok.extern.slf4j.Slf4j;

@Controller
@RequestMapping("/login")
@Slf4j
public class LoginController {
    @Autowired
    private LoginService lService;
    
    @RequestMapping("/checkLogin")
    public String  checkLogin(@RequestBody final String param) {
    	log.debug("param = " + param);
        return "index.html";
    }
    
    @RequestMapping("/updatePassword")
    public String  updatePassword(@RequestBody final String param) {
        log.debug("param = " + param);
        int i = lService.updatePassword(param);
        if(i<0){
            return "原密码错误！";
        }else if(i==0){
            return "修改失败！";
        }
        return "修改成功！";
    }
    
}
